//
//  DredgeVC.swift
//  DianXia
//
//  Created by you&me on 2017/12/21.
//  Copyright © 2017年 you&me. All rights reserved.
//

import UIKit

class DredgeVC: UIViewController {

    @IBOutlet weak var province: UITextField!
    @IBOutlet weak var city: UITextField!
    @IBOutlet weak var area: UITextField!
    @IBOutlet weak var street: UITextField!
    @IBOutlet weak var address: UITextField!
    @IBOutlet weak var submitBtn: UIButton!
    @IBOutlet weak var backBtn: UIButton!
    var code = ""
    let supportVM = SupportVM()
    let dispose = DisposeBag()
    override func viewDidLoad() {
        super.viewDidLoad()
        //提交
        submitBtn.rx.tap
            .subscribe({ [weak self] _ in
                self?.supportVM.activeRequest((self?.province.text!)!, (self?.city.text!)!, (self?.area.text!)!, (self?.street.text!)!, (self?.address.text!)!, (self?.code)!) })
            .disposed(by: dispose)
        //返回
        backBtn.rx.tap
            .subscribe({ _ in
                let vc = UIStoryboard.initialViewControllerFromStoryboard(.Home) as! UIViewController
                UIApplication.shared.keyWindow?.rootViewController = vc
            })
            .disposed(by: dispose)
        //是否链接成功
        supportVM.isRobotOpen.asDriver()
            .drive(self.ex_robotState)
            .disposed(by: dispose)
    }


    


}
